/**
 * Created by cchen on 2015/4/23.
 */

$(document).ready(function(){
    $('img').lazyload({threshold : 200 });
    //$('footer').hide();
    $.ajax({url:"js/download.json",async:false,
        success: function(res) {
            var u = navigator.userAgent, app = navigator.appVersion;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            var ua = navigator.userAgent.toLowerCase();
            var isWx = ua.match(/MicroMessenger/i) === "micromessenger"
            var url = "#";
            var os = "";
            if (isAndroid) {
                url = res.android.default;
                os = "Android";
                $("div.device_text span").css("font-size", "16px");
                if (isWx) {
                    $('footer').show();
                    url = res.android.wx;
                    os = "Android";
                }
            }
            else if (isiOS) {
                url = res.ios.default;
                os = "iOS"
            }
            $("footer a").attr("href",url);
        },error:function(res) {

        }

    });
});